#pragma once
#include<iostream>
#include<string>
#include<vector>
//s :要切割的字符串
//sep :切割依靠的分隔符
//out :切割后内容的存储位置
class Util
{
    public:
    static void cutString(std::string s,const std::string& sep,std::vector<std::string> *out)
    {
        //aaaa/r/nssss/r/naaaassdsa/r/n
        std::size_t start = 0;
        while(start < s.size())
        {
            auto pos = s.find(sep,start);
            if(pos == std::string::npos)
                break;
            std::string subs = s.substr(start,pos-start);
            std::cout<<"-->"<<subs<<std::endl;
            start += subs.size();
            start += sep.size();
            out->push_back(subs);
        }
        if(start<s.size())
        {
            //std::cout<<"size: "<<s.size()<<"start:"<<start<<std::endl;
            std::string sub = s.substr(start);
            out->push_back(sub);
            std::cout<<"-->"<<sub<<std::endl;
        }
    }
};